<!DOCTYPE html>
<html>
<body>
<p>MediaQueryListener should be triggered in the isolated world that created the MediaQueryListener.</p>
<div id="result"></div>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

testRunner.evaluateScriptInIsolatedWorld(1,
    'var query = window.matchMedia("(-webkit-min-device-pixel-ratio: 3)");'+
    'query.expando = "nyan";'+
    'query.addListener(function (event) {'+
    '    document.querySelector("#result").innerHTML = event.target.expando === "nyan" ? "PASS" : "FAIL";'+
    '});');

let query = window.matchMedia("print");
query.addListener(() => requestAnimationFrame(() => testRunner.notifyDone()));
internals.settings.setMediaTypeOverride("print");
</script>
</body>
</html>
